<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>友情链接</title>
  <link rel="stylesheet" href="../assets/lib/layui/css/layui.css">
  <!-- 自己的 css -->
  <link rel="stylesheet" href="../assets/css/link/link.css">
</head>

<body>

  <div class="layui-card">
    <div class="hd">
      <div class="layui-card-header">友情链接</div>
      <button type="button" class="layui-btn layui-btn layui-btn-normal addlink">添加链接</button>
    </div>
    <div class="layui-card-body">
      <table class="layui-table">
        <colgroup>
          <col width="5%">
          <col width="15%">
          <col width="20%">
          <col width="30%">
          <col width="10%">
          <col>
        </colgroup>
        <thead>
          <tr>
            <th>ID</th>
            <th>链接图标</th>
            <th>链接名称</th>
            <th>链接地址</th>
            <th>链接描述</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>

        </tbody>
      </table>
    </div>
  </div>



  <!-- 友情链接列表 模板渲染 开始 -->
  <script type="text/html" id="get-link">
        {{ each data item }}
        <tr>
            <td>{{ item.id }}</td>
            <td>
               <div class="td-img">
                    <img src="http://localhost:8888/uploads/{{ item.linkicon }}" alt="">
               </div>
            </td>
            <td>{{ item.linkname }}</td>
            <td>{{ item.linkurl }}</td>
            <td>{{ item.linkdesc }}</td>
            <td>
                <button type="button" class="layui-btn layui-btn-xs edit" data-id="{{ item.id }}">编辑</button>
                <button type="button" class="layui-btn layui-btn-xs layui-btn-danger delete" data-index="{{ item.id }}">删除</button>
            </td>
        </tr>
        {{ /each }}
    </script>
  <!-- 友情链接列表 模板渲染 结束 -->

  <!-- 添加友情链接 弹出层 开始-->
  <script type="text/html" id="eject-link">
        <form class="layui-form" id="form-link">
            <!-- 名称 -->
            <div class="layui-form-item">
                <label class="layui-form-label">链接名称</label>
                <div class="layui-input-block">
                    <input type="text" name="linkname" required lay-verify="required" placeholder="请输入链接名称" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <!-- 地址 -->
            <div class="layui-form-item">
                <label class="layui-form-label">链接地址</label>
                <div class="layui-input-block">
                    <input type="text" name="linkurl" required lay-verify="required" placeholder="请输入链接地址" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <!-- 描述 -->
            <div class="layui-form-item">
                <label class="layui-form-label">链接描述</label>
                <div class="layui-input-block">
                    <input type="text" name="linkdesc" required lay-verify="required" placeholder="请输入链接描述" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <!-- 上传图片 -->
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="file" name="linkicon" id="file" style="display:none">
                    <button type="button" class="layui-btn layui-btn-sm upload-img">
                        <i class="layui-icon"></i>
                        上传图片
                    </button>
                    <img src="" class="img-preview" alt="" style="display:none">
                </div>
            </div>
            <!-- 提交和重置 -->
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">添加</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </script>
  <!-- 添加友情链接 弹出层 结束-->


  <!-- 编辑友情链接 弹出层 开始-->
  <script type="text/html" id="edit-link">
      <form class="layui-form" id="form-edit" lay-filter="edit-luayui">
          <!-- 名称 -->
          <div class="layui-form-item">
              <label class="layui-form-label">链接名称</label>
              <div class="layui-input-block">
                  <input type="text" name="linkname" required lay-verify="required" placeholder="请输入链接名称" autocomplete="off"
                      class="layui-input">
              </div>
          </div>
          <!-- 地址 -->
          <div class="layui-form-item">
              <label class="layui-form-label">链接地址</label>
              <div class="layui-input-block">
                  <input type="text" name="linkurl" required lay-verify="required" placeholder="请输入链接地址" autocomplete="off"
                      class="layui-input">
              </div>
          </div>
          <!-- 描述 -->
          <div class="layui-form-item">
              <label class="layui-form-label">链接描述</label>
              <div class="layui-input-block">
                  <input type="text" name="linkdesc" required lay-verify="required" placeholder="请输入链接描述" autocomplete="off"
                      class="layui-input">
              </div>
          </div>
          <!-- 上传图片 -->
          <div class="layui-form-item">
              <div class="layui-input-block">
                  <input type="file" name="linkicon" id="file" style="display:none">
                  <button type="button" class="layui-btn layui-btn-sm upload-img">
                      <i class="layui-icon"></i>
                      上传图片
                  </button>
                  <img src="" class="img-preview" alt="">
              </div>
          </div>
          <!-- 提交和重置 -->
          <div class="layui-form-item">
              <div class="layui-input-block">
                  <button class="layui-btn" lay-submit lay-filter="formDemo">添加</button>
                  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
              </div>
          </div>
      </form>
  </script>
  <!-- 编辑友情链接 弹出层 结束-->

  <script src="../assets/lib/jquery.js"></script>
  <script src="../assets/lib/layui/layui.all.js"></script>
  <!-- 模板引擎 -->
  <script src="../assets/lib/template-web.js"></script>
  <!-- 公共配置 js -->
  <script src="../assets/js/common.js"></script>
  <!-- 自己的 js -->
  <script src="../assets/js/link/link.js"></script>
</body>

</html>